//
//  CTMediator+CYNetwork.m
//  CYNetworkComponent_Example
//
//  Created by lc4y on 2018/2/15.
//  Copyright © 2018年 lc4y. All rights reserved.
//

#import "CTMediator+CYNetwork.h"
#import <YTKNetwork/YTKNetwork.h>

// 模块名称
NSString * const kCYNetworkTarget = @"Network";
NSString * const kCYNetworkRequest = @"kCYNetworkRequest";
NSString * const kCYNetworkServerURL = @"kCYNetworkServerURL";
NSString * const kCYNetworkCommonArgu = @"kCYNetworkCommonArgu";

// GET请求
NSString * const kCYNetworkActionGetDataFromServer = @"getDataFromServer";
// 配置服务器地址
NSString * const kCYNetworkActionConfigServerURL = @"configServerURL";
// 配置公共参数
NSString * const kCYNetworkActionConfigCommonArauments = @"configCommonArauments";

@implementation CTMediator (CYNetwork)

- (void)CYNetwork_configServerUrl:(NSString *)serverUrl {
    [self performTarget:kCYNetworkTarget action:kCYNetworkActionGetDataFromServer params:@{kCYNetworkServerURL:serverUrl}
      shouldCacheTarget:NO];
}

- (void)CYNetwork_configCommonArguments:(NSDictionary *)commonArgument {
    [self performTarget:kCYNetworkTarget action:kCYNetworkActionConfigCommonArauments params:@{kCYNetworkCommonArgu:commonArgument}
      shouldCacheTarget:NO];
}
    
- (void)CYNetwork_getDataFromServer:(CYNetWorkRequest)success {
    [self performTarget:kCYNetworkTarget action:kCYNetworkActionGetDataFromServer params:@{kCYNetworkRequest:success}
      shouldCacheTarget:NO];
}


@end
